trying to figure out why the kernel is failing to complete properly in the last iteration