fix bug, slow performance