fixed bug with id and index