Improve the ref validation test. It checks all refs and fragments now.