Fixed a bug in max()