Adding callback for error handling