Back-ported fix for #132.