added some sanity checks on variable elements