trying to fix the buffer bug