Some minor bugfixes