Port fix from https://github.com/plone/plone.app.portlets/commit/25fb987f3442032f5d95231e6a329d262c2c9532