Fixed module instantiation with wrong mode

I have only replaces it in safe places, when no more changes in the code. They are others that could be changed but need more changes in things like method calls.