Change code to behave as docs say, using stat instead of stats