fix cross-compilation issue with Numpy
reorder the if's for clarity