Added a few sanity checks