detect type of var