undefined vars fixed