fix match and resolve unit tests