fix a bug in writing charge regionwise