Improve repec validation function.