Input defensive code