Fixed race condition in the viewer when using the ram buffer.