Fix swap_buffers issue