fix bug so tests pass; update docs