fixed writing to BerkeleyDB and serializable IDs