Fix if/while pattern bug