pattern_guard bug fix