changed delete of tmp colorptrmap to clear