add a helper function to test if an object is on the stack