Move type checks ahead of task/nil check.
More refactoring of the test suite.