Major bug fixes

I'm not a smart man