Fix some bugs.