Solves https://bugzilla.wikimedia.org/show_bug.cgi?id=57144

This patch was suggested by Kipod, push by me in order to fix upstream.