Rename variable dup -> duplicate to unbreak build (warning on global
shadowing).