Corrected an error message
Refined the permission checks