Fix a ref parsing cannot be handled correctly bug