Role of defects on the gas sensing properties of carbon nanotubes thin films: experiment and theory