Fix an issue with expansion of SCM repository directory names
Fix issue where the error handling routine could run twice