db: use id, not handle, as primary key