add an error handler on loading