fixed bug in sanity check