fix consistency wtiting. fix write cmm