Fixing the CORS requests and fixing bug in login