function quit working with build 205

 
This function, which used to work correctly quit working with build 205, can you let me know how to fix it.
What it used to do is return .01 if the previous trade of the same type was a winner, or if the previous trade was a loser return twice the lotsize of previous trade.

double lotsize(int type){
   
   double lot=0.01;
   if (type==1)
      if (GlobalVariableGet("LastTicket1")!=0)
         if(OrderSelect(GlobalVariableGet("LastTicket1"),SELECT_BY_TICKET,MODE_HISTORY)==true)
            if(OrderProfit()<0)
               lot=OrderLots()*2;         
   if (type==2 )
      if (GlobalVariableGet("LastTicket2")!=0)
         if(OrderSelect(GlobalVariableGet("LastTicket2"),SELECT_BY_TICKET,MODE_HISTORY)==true)
            if(OrderProfit()<0)
               lot=OrderLots()*2;        
   return(lot);
   }