Add sanity checks to vector functions

Previously passing nil to the vector functions would cause a untraceable error. Now it produces a backtrace.