Updated functions for saving and recovery of Buffer from file