fixed argument parsing and exit code