make tasks execute on the right thread