enhance optional directory to handle paths