Lesson 5 Mnist overfitting

Hi, I just completed lesson 5 and working on kaggle Digit Recognizer Mnist dataset which consists train.csv and test.csv. In training set each column from 1 to 785 represents pixels and column 0 represents labels.
I have completed the lesson 5 SGD and it was working fine for me and was predicting perfectly.
Now, When I use almost same approach in Digit Recognizer dataset it is just not working, the model is underfitting everytime. I really want to know why it is underfitting? Am i doing wrong in data pre-processing? or something else? I tried