Var was not assigned
Added sanity check