Fix wrong buffer indexes