fix relay bug, now is able to control relay without matlab crash