#478, tests pass (hopefully)