fixed some bugs in addRecord