Cleaner code for reflection int magic
Add overflow checks in int conversion