Fix bug with duplicate data in DB