Fixed bug generating a numpy array of weighted means using PyPy.

Obtaining nvariables in find_optimal_block was failing.