Fix bugs in fetching user from session