Fixed issues for upstream merge.
Fixed issues for upstream merge.