Fixing bug with authentication