Fixes bug #1364939

This pull request, together with juju#1026, fixes the bug #1364939.