added callback for error