fix bug in match method