Fixed a few bugs I think