implement trim() in BerkeleyStorage