minor bugfixing and improvements