Fixing utterly broken type inference. How did I not catch this before now?