Changed EOF to -1 in getopt loop