fix some bugs from the latest build.