fixes the case when BufferExtensions.decideBufferLength returns the value that is greater than the period duration