Changed code again for correct processing of record