Better move the argument check to the *beginning* of the function (as code before this place aos uses key_id)