Fix code generation logic for call to excluded range