made delete node more fail-safe