Fixed some bugs;