added some logic to addres  certain defect in data