I just fixed it...
I can't believe how stupid the problem was...

the reason I couldn't reproduce the error on my board was because I was using a completely different version of the code.
Somehow I managed to zip up an old version of the code for the attachment.
I'm just adding the requested avatar functionality, and I'll upload the new version.
::hides face in shame::