modified error handling in function ...get_vertex_id