fix handling of cmdargs