found and fixed bug connected with wrong CalcQ() flow and wrong circuit indexing