Bug fix in updateTreeMap