Fixed a bug with parent matching