handle user_limit properly and fix max_id