Add sanity checks to datasource
Fix truncating of error messages