error handling
scripted update of code from master at 9d32352 error handling