Replaced getfsize with os.stat