fixed a division by zero error and enabled non-flush mode