I am not sure what problem you get with those two rules. Maybe you should add a rule which handles ways without a ref?
Besides that I don’t understand the phrase “OSM internal refs”. OSM doesn’t need any internal refs.