fix matching code