Improve boolean operator conversion script according to Tobias.

Untested on OSX, but if it works, or is used on Linux, probably more
robust.

Closes issue #129