The username matching was working as intended but the session's active value was ignored when queries were being routed. This meant that both the username and the IP address of the user were ignored and query replacement was always done.