fixed buffer problem