Fix some IR types

This PR fixes many type errors in the IR (almost all of them).