backport to 0.5