Merge "Fix error check for surface type in setSurface"