fix issue #11, sample_file for optim does not work