Fixed a few bugs from copy-pasting