layin PermissionError exception handling

further support for better Exception handling.