Fix various idiotic bugs

PURGE THE UNCLEAN FROM THE MASTER BRANCH