Fix selection bug with empty nodes.