Add file macro and bug fix