fixed error handling and forbidden access handling

fixes #29 #31 #12