fix argument parsing code