added buffer for last state file i/o