Fixed bug at checking error code from file stat