compare stack tags as well as item id

Fixes issue #1845