Fixed index bug in zsort usage in the background potential energy budget