Patched val name detection to work for inheritance.