fix logic err