Fix register and check thread exception