Fix ids and remove invoke when inlining.

Bugs found by Razvan Lupusoru.

Change-Id: I3a5a9af280d8700d18f52abb4a2cff0e3a9aac74
Merge "Fix ids and remove invoke when inlining."