fixed some segfaults, and added to Vector code