Fixed error with value casting. Cast to Number before getting value.