fixed null-pointer in number generation