#998 Fix a bug in uploading avatars
Merge bugfixes from Luna 0.1