Fixed some bugs with API duplicating new records