Some small fixes and improvements