fixed some bugs