Fix bug when detecting id