Markets rally as investor optimism crawls back