fixed local sorted variables