Fix typespecs to correctly pass dialyzer tests.