maximum path sum: avoid exit(0)