lots of bugfixes, added a fetchavatarimage function