fixed heap corruption finally