implement getMaterialDiff
fix up the api