Fixing misplaced isFirst set (was too early, was using it after branch)