Fix db dump script

This script is still disabled, but these are the fixes for it.
Hm, this seems unrelated to this PR, right?