improve sigmoid and its gradient evaluation