Corrected some bugs.