Fixed typo in permission checks.
Removed unused imports.