change how duplicate works to avoid newline issue