Negative index in online median filter

First, thank you for all your great work. It is very much appreciated.
Second, the question. I run an online median filter in one of the classes in my project. I have multiple instances of this class and thus several online median filters. The problem that I run into after my program has run for a while, is that the offset parameter in the median filter becomes negative. The offset parameter is used as index for a double array, such that the call to ProcessSample throws an error. Based on my understanding of the implementation of ProcessSample method, this should not be possible. Has anyone else experienced anything like this? Are there any precautions that I should take when dealing with many instances of a median filter?
Thank you for any response!

Are you by chance feeding samples in through multiple threads? The method doesn’t look thread-safe to me as is (maybe something to fix).