If the value to be deleted (on the top of the stack) is also present inside the stack, hitting the remove button deletes the other one. For example, in the figure below, the third 54 (circled) will be deleted if Remove button is clicked. Requires investigation and fix!
