minor fix with duplicate key exceptions