make sure the stack has enough elements