Fixes out of range issues with index buffer
Fixes some errors on firefox