Fixed clearing and dir type filtering