fix for ref names, should also be faster now