fixed ValueError: max() arg is an empty sequence