Fixed pointer to wrong data buffer problem