Fix duplicate entry protection

Fixes #6