updated 4.5 for handle duplicated keys