Bug fixes for running script in other directories and miscellaneous enhancements.