Fix undefined method when node does not exist