Standard deviation calculation code not working as intended - C#