Fixed a subtle bug in the ID conversion