Fix email and token function