use stat return value for correct error handling
use stat return value for correct error handling

rampantpixels/foundation_lib,rampantpixels/foundation_lib,rampantpixels/foundation_lib,rampantpixels/foundation_lib