Fix tidyPath to work as specified in Javadoc