Replace bound check with try..catch it is faster in the nominal case.
Remove unnecessary casts in the generated proxies.