fix permission check typo (thanks to #4365)