fix variables undefined