Fix wrong shared mem index computation.