Fix module creation errors on Linux

Take a look at my commit comment for more details.