Added check for bad values of aggregate