Small bug in MaxProf function corrected