Fixed KMP and full loop with maintenance.