added edge case when there was only one node