fix bug in getRecordWithName