tests fixes and improvements