Fixed a few bugs, getting ready for live tests