added ignore flags to the drain method