Added undefined check for error_callback
Added undefined check of error_callback