[FIX] stock: backport fixes from master