A couple of bugfixes