Fixed problem of adding too many units

Seemed to have fixed the problem where units were added to the database
when they shouldnt have been.