fix scope problem, thanks @tomchentw++