Check your headers; it almost sounds like you're doing something that isn't provided for in old headers? Also, you're certain that the data isn't incorrectly formatted? Check your code that works vs. the code that doesn't. As a last point, this operation may only work properly when invoked inside module_scripts- there are a number of things like that. You may need to port that out, call it from within your logic and have it return what you need to continue your logical operations.
Wish I could offer more concrete help on this, but I haven't messed with that area of the engine.