Some various small fixes and improvements