Fix regression in performance introduced in #a26a47f