updated after last upstream merge