Fixed endless recursion of flush().