Fixes to make spec tests pass