Fix some bugs. Inexplicably still broken in jit.