update function for file