Backport to precise and wheezy