A few small fixes and improvements