Fixing sessions and user login to work properly