Fixed wrong error type when no valid credential will be given