Fix bug in wrong directory output