Fix auto(un)boxing casts for compatibility with older -source (e.g.
Android)