add exception handling for put request