Bug fixes for the cv matching