Fix folding bug