Fix crash in pattern changeover