fix a performance bug