TST: add more testing, fix a bug, more bugs remain