more test units, fixed some bugs