Fixed a couple of small bugs. *UNTESTED*