ported c82ba2c3fac6cc3724b691011b5ad582bc169edf, refs #1084