fix NoneType error in affect_nodes