Fix some bugs.

Fix some unimportant bugs. It's test in 50x50x50 grids locally and local
network, and works well. Still more test.