cherry-picking #30