fix test when using NumPy 1.7
merge 0.18.x branch into master