improved dictionary merge nonzero