Fixed SQL bug in dump