[bugfix] Correctly free java var