fix some bugs and makes debug off