Attempts to fix some weird array out of bounds error