Fix to properly keep track of the user sessions (to send beacons).

See javadoc in the changed class.