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