added a few sanity checks