fix bug and add snappy compression support