Added validation to avatar uploading handler