add tests
fix a crash on --complete