getNodeByRange returns the correct node when giving the first position

The function getNodeByRange now gives the correct node back that is in that range.