Merge "Avoid exception with instanceof" am: 04162bc875
am: 34247dc279

Change-Id: Ia192bd056d1331abbc6a49ad3af449b74fcd12a9