Fixed bug calculating zone boundary replacement