made indexing correct for int image