Fix OOME errors in tests