Added error handling when updating