Fixing bug in foreachPropertyAChildShouldBeOfType