Fix find_gname to work with the first node