implement #951, better command line handling