function getStats() revised
part (1/2) of bugfix for #1067