change the logic of serial receive