fix context call to not use not yet initialized module instances

I know that code is not DRY and that it deserve its test case. I send it just to show idea how to solve it and how it works.