Mmh, attempt to fix some bugs with error messages