fix error handling in put