more bugfixes and polish