Added assert to prevent OutOfMemoryError during tests