Some random bugfixes