Fixed overflow bug in sigmoid function.