changed numpy arrays from 64bit integers to 32 bit integers, plus some bug fixes