correct match function