Fixed sort order
Added support for exceptions in the statSync call, plus a fix in the sort calculation