Bayern Munich coach Pep Guardiola admitted his side had been lucky to come away from Hoffenheim with a 2-1 win on Saturday.