stupid buffer implementation