EncodeInteger func implementation changes