fix use before definition bug