Fix next with repeat all not working at end for some places