Improvements to errors and callbacks