some fixes
found some bugs