Also I just discovered that this happens only with preamble caching enabled! If preamble caching is disabled then everything works fine.