fix swap every n step bug