fixing permision and sessions in login