Correct compilation of shared library and python module

The changes here address the issues mentioned in #231.