put the lock at the top, we might not have samples for a while and the first read will fail