Adding error trap around setting content type