fix performance bug.