Added better checking