Move to more reliable method for user's current session
Fix for my sanity
Fix compiler warnings