bucketDir can also be a function