see https://github.com/dimagi/commcare-hq/pull/870