Corrected a few bugs.