Fixing empty nodes problem