Fix huge performance bug