many small fixes and improvements