only create prefix directory when necessary