Fixed setuser function