Fix buffer switching