Fixed memory leak and error on null user.