Fix return type of aggregate methods — it's not guaranteed to be an NSNumber

Closes #709