I think that I have finally fixed the bug..