Fixed a few bugs: