Thread id was being passed as a pointer