Some fix and improvements