Fix a couple errors & add a couple tests.