Fix error in non-loop mode