fix varint implementation