Backport fix for selecting big directories from master.