fixes duplcate foreach key