rename local variables to minimize the risk of overlapping with names stored in data file
(cherry picked from commit 3aa94198356b6112d9bcfb5617b090d7309c737b)
Fixed bugs related to the case where no shock standard deviation is estimated
(manual cherry picked from ad34f3dbf1889bbb0c76a565a865ff0d3343e06f)