It turns out that Jan's problem was caused by a bad interaction with the svn-multi package. My code didn't cope correctly with the situation where a file is read in during the processing of the preamble and written out during the processing of the document body.
The attached update seems to fix the problem. Perhaps someone with commit access could update the LaTeX bundle with this new code?
Thanks, Robin