Fixed a typo and improved the getopts.