Check for garbage value on resultBytes and correct (int) casts