Fix case class bug