#4 added sanity check