Integer conversion bug fixes