ommited the code related to fstat