fixed  some bugs.