Small performance fix for periodic bcs