Fixes an error in session validation