fixed bug in dbow code, and made improvements