Fix bug that frees the tranformed schedule incorrectly.