code cleanup, improve dbdump