copyObject wasnt taking into account the actual type of the input object. mostely this goes ok but for some cases there were multiple choices and it might default to the wrong case