Fixed permissions check.