Fixed some id related bugs