Fixed a few final bugs