fix buffer states