Fixed isuues for upstream merge.