Merge Tiago's TAO fixes.