Trying to work around the PEOF error problem in XOM.

Not finished yet.