Fixed the bug that prevented permission check