fix some bugs, introduce some more.