minor optimization of gamma