Fix Int vs Long tensor issue