fixed bugs in command line arg parsing