bugfixes and polishing