renamed sex to gender
checking if there is a user before trying to access its gender