fixed passing command line args to getopt function