Add bounds checking to updateVector