minor bugfixes and improvements