fixed the substring issue with d['id']