fixed deleting of a resource and added test