improved sanity check