add more tests, fix argument processing bugs