Fixed referenced types iteration order. Added further files for tests