fix a bunch of type errors