fixed bug with pixel index