Found and fixed crashing bug due to stat() failure