Fixed lastID issue