Fixes test failures

This fixes a number of issues with the previously merged PR. Tests should pass.