Fixed bug in sample.phi