dont mutate file unless it worked