repair swig Ternary operation and syntax errors

Swig doesn't support ternary operations with setting new variable. Apart form that there were some syntax errors.
Merge pull request #69 from Trandel/patch-1

repair swig Ternary operation and syntax errors