added another check for valid vertex IDs