Add improved permission and error handling in version 1.0.5