fix bug with local var