Fix issue #659, and cleanup wallet/command-line argument handling a bit