Fixed problem for maximum values