added supprt for PBCs