fix for torn buffer.