Overwriting a variable changes the variable type to numpy array, which causes the issue later. This fix is taken from the master branch.