wip(history): fix HPI query