Deferred file uploading

Fixed issue #22