fixed for loop after getopt