Fixed issue when deleting record.