Changed k from int to short in gamma.cpp and gamma.h