updated getArrayCopy to only return key/value pairs if the value exists