Added abort_on_error function, currently called with graphics mode change was not successful