more bugfixes and tweaks