FIxed some bugs