fix some issues in the new loop impl