Error when swaping surfaces

Under certain circumstances adding a child to another displayobjectcontainer can lead to a parentNode = undefined error. Please see the appended demo code:

	class Main extends Sprite {
		public function new() {
			super();

			var c:Sprite = new Sprite();

			var s:Sprite = new Sprite();
			var s2:Sprite = new Sprite();

			s.scrollRect = new Rectangle(0, 0, 10, 10);

			c.addChild(s2);

			c.addChild(s);
			c.addChild(s2);
		}
	}