Fix bug in generate_npy.py