made drawCircuit slightly more robust