Fixed rendering array out of bounds exception