Edit records, fix sql script