Fix bug in getExtremeValues