fixed a bug on pbc