very subtle threading bug fixed.