Refactored post loop bug fix.