improve variant cast error reporting