added checks for optional sourcing