Fixed rmNode function