fixed none value for max_id