Use int for signed value to fix android portability