Random set of bugfixes