fixed init of max from 0 to -maxint