Fixed bugs in api.downloadFile().
Merge pull request #49 from luuse/api_download_bugfix

Fixed bugs in api.downloadFile().