I couldn't spot anything in the code and not able to reproduce. Can you print $tu in the log messages, like:
``` if (registered("location", "$tu")){ xlog("L_INFO", "$rm $ci - [$tu] registered"); } else{ xlog("L_INFO", "$rm $ci - [$tu] NOT registered"); } ```
Add also:
``` log_prefix="{$mt $hdr(CSeq) $ci} " ```
and set debug=3 in order to get all debug messages. Reproduce the case and attach the all debug message for analyzis.