Don't use empty data sets.

Which means, no divison by 0.
Use a time barrier to remove temporary data from the buffer.