Add more checks to vector functions