Fixed rulegen threading bug