Fixed a performance regression in 2.1.7