minor bug fixes to auto-detection and command line parsing