fixup of some bugs