removed getopts dependency
correct printing of errors