fix swap buffer