Improved session validation