added function for trimming dbm-format databases