Fixed possible failures due to overflow when casting to int32 in a sub-expression.