Some fixes and improvements.