added missing "var"
fixed selection bug