bug 1003: Make scripts resilient against working directory changes and