several small fixes and improvements