Bug fixed for idx