fix bug for missing variables