backport lp:1392390 fix to 1.21



(Review request: http://reviews.vapour.ws/r/481/)