Fixes null pointer when logging in/out