Fixed a random offset problem.  Fixed a possible threading problem.