minor bugfixes and polish