Fix repeat to end functionality