fix periodic boundary