#51 fix always not wrap around when replacing