added error handling if user denies access permission