Fix to support FreeBSD's stat(1)

Added check for OS type
Added FreeBSD syntax in case of $os=freebsd