Merge "Fix bugs with takeSurface and preserveWindows." into nyc-dev