Added checking for defined source