Scotland held on for an unconvincing victory over Canada in Toronto in the second Test of their summer tour.
The hosts will count themselves unlucky, with Jeff Hassler touching down and James Pritchard kicking the rest of their points.
Scotland struggled to impose themselves in attack after Grant Gilchrist scored his first international try.
Stuart Hogg thumped over a long-range penalty, with Greig Laidlaw's boot providing the remaining points.
Next up for Vern Cotter's charges is a Test against Argentina and the Scots will need to deliver a much improved performance to be competitive in Buenos Aires.
The visitors started brightly and Laidlaw showed great judgement in windy conditions to kick them into the lead with an early penalty after Canada went down in the scrum.
Phil Mack thought he had put the hosts ahead in six minutes when the scrum-half ran over but Hassler had knocked on in the build up.
Laidlaw then had a try ruled out for a knock-on following a messy Canadian scrum, as mistakes littered the early stages.
Former Glasgow Warriors winger Taylor Paris showed his pace with a fine run and Hogg was penalised for going off his feet to stop him, with Pritchard knocking it between the posts to level the scores.
And it was 8-3 to the home side when centre Ciaran Hearn's excellent run and off-load set up Hassler to cross the line, despite the attentions of Tim Visser. Pritchard missed the conversion.
The points kept coming and this time it was the Scots who grabbed a try, as Laidlaw's pass freed Gilchrist to barge his way over. Laidlaw converted.
Alasdair Strokosch left the field on a stretcher with a neck injury after putting his head in where it hurts to help halt a rampaging Canada attack.
Cotter's Scots were finding good positions in the final third but all-too often their handling was below-par as chances came and went.
Laidlaw banged over a simple penalty three minutes from the break following another scrum infringement and it 13-8 as the sides left the field.
Scotland started the second half by conceding a soft penalty after a handling offence, and Pritchard slotted over.
Canada took a deserved 14-13 lead when Scotland were caught offside, allowing Pritchard to knock over another penalty.
The Scots began to build again, though, with Visser and Hogg leading the charge, and the latter banged over a penalty from just inside the Canada half for a 16-14 lead.
Pritchard saw a penalty come back off the post and Laidlaw reacted well to clear, but the Canadians were in the ascendancy and the lively Phil Mack was a real threat.
As the visitors were caught offside again, Pritchard had another look at the posts and this time he made no mistake, giving the hosts a 17-16 lead with 10 minutes to play.
But replacement scrum-half Gordon McRorie's poor kick put Canada in trouble straight from the restart, and an offside decision allowed Laidlaw to fire Scotland ahead.
Canada were forced to play the last few minutes with 14 men after Jebb Sinclair saw red for leading with the elbow on Ruaridh Jackson, and the Scots held on for the win.
Canada: Pritchard, Hassler, Hearn, Blevins, Paris, Jones, Mack, Buydens, Carpenter, Marshall, Hotson, Cudmore, Sinclair, Moonlight, Ardron.
Replacements: van der Merwe for Paris (46), McRorie for Mack (71), Tiedemann for Buydens (55), Barkwill for Carpenter (59). Not Used: Ilnicki, Gilmour, Phelan, Braid. Sent Off: Sinclair (76).
Scotland: Hogg, Maitland, Lamont, Horne, Visser, Russell, Laidlaw, Reid, Lawson, M. Low, Gray, Gilchrist, Strokosch, Brown, Beattie, Jackson.
Replacements: Evans for Visser (76), Jackson for Russell (65), Cross for M. Low (49), Cowan for Strokosch (31), K. Low for Brown (49), Bryce for Beattie (63), Hart for Jackson (77). Not Used: Traynor.
Ref: Mike Fraser (New Zealand)