Based on the patch by mahendra.n. Fixes bug #757663. https://bugzilla.gnome.org/show_bug.cgi?id=757663