some sanity checks on input