Fix empty tagstack handling