fixes https://github.com/torchbox/wagtail/issues/564