check if stat succeeded
check if stat succeeded, count instead of sizeof