fixed some bugs.