merged old patch to fix directory filtering