Improved command-line error checking