Fix velocity offsets and account for periodic wrapping