Fixed crashed when vector is empty