Fix casematching bug