Fix buffer problem