Some fixex and improvements.