fixed getopts handling