fix double buffering