fixed method to replace a None node with a value node