added latest changes from upstream