use function to detect local or download source; fix typo