Fixed some bugs.