Fix for 64 bit Linux, imported from pyShiva
Some cleanup.