fixed possible database unique errors and updated models