Fixed broken filesize

Noticed that the filesize was incorrect for files.
added tests
Merge branch 'milesj-patch-2' into 1.2.x