MODE-2017: Implementation for the  renaming procedure

This pull request contains small fix for handling renamed nodes and incorporates test provided by @eshevchenko which highlights the problem.