Fix a bug: Previous unused node index is invalid