fixing up the dbwrite cookbook