bug fixed
EOR is more correctly implemented