Update legIK.py

Numerous bug fixes