fix several bugs with arithmetic instructions