Add a new method to construct vector.fix some bugs in if-statment.