Bug Fixes

Hopefully did not break everything.