fix some more checks, added source position in error messages