fix execption and add arg parsing