Have you tried to step through the code and see what is being returned from the module function ?

Maybe you could post the InitialiseOsTransform() function so we can see whats happening ? because as Honeybee said without seeing what is happening we cant really help.