Fix db dump script

This script is still disabled, but these are the fixes for it.