Fixed a few bugs.