Bug Fix: Only set the file size after getting the file contents

  * Also fixed compilation error