Give command-line flags priority over the config file (plus minor fixes)

(I don't know how to submit separate pull requests (apart from branching it three times for each one-liner, which sounds like overkill!), sorry)