fix logical bug