fix serveral warnings for undefined vars