fix problems with gamma distribution

should finally fix the #245