Fixed a performance bug