Fixes for tests

Stupidly neglected to run tests locally on the changes, so nearly everything failed.
The bugs introduced that caused these failures have been resolved.  All tests now pass.

Signed-off-by: Daniel Hunsaker <danhunsaker@gmail.com>