vertex validation and bugs fix