Fix up config reading

and stderr output when running in foreground mode