Fixed a performance bug introduced in the last commit