Fixed retry_on_failure_bug
Added more tests