New dumpaddresses method to fix dumpprivkeys

See bug #935

Temporary fix. There is a probably a better way to do this but at least, it doesn't throw an exception anymore.