added some double-checking of data