Fixed issues uncovered by spec tests.