unregister on logout crash fix