Wall Street shakes off Amazon, Apple weakness to end modestly higher