Bugfixes, Round 1

Multiple fixes for brain farts throughout the code