Some minor bugfixes and adjustments