Moved scope of rescue handling to cover main loop