hopefully fixed threading issues