fix error with indexErrors