Various bugfixes I can't remember