Fixes to retrieve file attributes correctly