Fixed sleep function in filter