I've had similar problem regarding redirecting the traffic based on URI and we've observed, that sometimes there is problem with set command, which does not fill the variable...
I would suggest to try to relace the
if { [persist lookup uie $resPers] equals "" } {
with
if { [persist lookup uie [HTTP::cookie "JID"]] equals "" } {
and see if the problem persists. At my own scenario, set failed to fill the variable with [LB::status] at HTTP_REQUEST event and later condition failed as the variable was empty. This could be the same as if the $resPers is empty, You are adding new persistency record.