fix remove_duplicates

Signed-off-by: Andrew Tselischev <andrewtselischev@gmail.com>