Fixing permission check