Added an if that verify if sample is true.