fixing bugs and authenticating session