fix permission checking issue