Fix output of error messages

err is not a string, so convert it to one