PrintDebug("Writing %d bytes\n", length - bytes_written);
     while (bytes_written < length) {
-       int tmp_bytes = v3_file_write(fd, buf + bytes_written, offset + bytes_written, length - bytes_written);
+       int tmp_bytes = v3_file_write(fd, buf + bytes_written, length - bytes_written, offset + bytes_written);
        PrintDebug("Wrote %d bytes\n", tmp_bytes);
        
        if (tmp_bytes <= 0 ) {
     
     PrintDebug("Reading %d bytes\n", length - bytes_read);
     while (bytes_read < length) {
-       int tmp_bytes = v3_file_read(fd, buf + bytes_read, offset + bytes_read, length - bytes_read);
+       int tmp_bytes = v3_file_read(fd, buf + bytes_read, length - bytes_read, offset + bytes_read);
        PrintDebug("Read %d bytes\n", tmp_bytes);
        
        if (tmp_bytes <= 0) {
 
 
 
 v3_file_t v3_file_open(struct v3_vm_info * vm, char * path, uint8_t mode) {
+    void * priv_data = NULL;
     V3_ASSERT(file_hooks);
     V3_ASSERT(file_hooks->open);
-    void * priv_data = NULL;
     
     if (vm) {
        priv_data = vm->host_priv_data;