Fix some bugs, not finish yet.