fix handling of empty stacks and variants for dry