Fix a couple of bugfixes