fixed tanh to not perform two exp functions