Added trace errors where appropriate.