Fix a duplicate entry SQL error