permission check and error message added