added exception handling for denied access