fixed Nil case for max()