some slight modifications for PIC32MZ