Thanks for the question. Erection problems may be due to psychological or due to stress, as you have had normal erection before this may be an onset of it. If you are getting a night time or early morning erection while masturbating then it would be mostly non organic in nature. I would ask you to keep check on the symptoms and consult a doctor when these get worse or continues. In the mean time you need to relax and reduce your stress as it would help in many ways.