modified onMatched to mainthread