Fix infinite rendering loops

This somehow is not merged into mater.