Use a real type, not integer, for the "Duplicate" layer's index parameter.