Provided real fix for segfault, also fixed picture uploading.