working out wierd thread issue