fixed NaN resultPerpDir
fixed typo