Make sure lastRepeat gets set in the function