check if tx is null first