fix error message handler for invalid credentials