This is quite simply a bug in your code. You'll need to show the code.