extra infinite loop protection, fix for an issue caused by type shadowing