handling exceptional case - empty node
enable logging
refactoring and add test