Add extra sanity checks when initializing a stack