fixed a serious code emission bug related to while. I had a typo in my assignments when inverting conditions for the construct. Added a test program to help prevent regression.