Correcting logic of last transaction and also fixing NPE in
savedamageproductcheck