updated to get a working copy into database