fix bug in passing of cmdline args; remove unused code