Fix for keyerror in a system with multiple cycles.