added casting to last var