fixed the problem of duplicate additions to the database