fix use before definition bug from c8f3974a2