fixed indexing bug with y displacement