added some input sanification