Exit condition fixed.