further fixes for missing trailing slashes on dirnames