Fixed issue with maximum and minimum functions.