Fix permissions check