core: store sourceType and use it instead of retesting the source.