some smaller fixes of indices and initialization
improve method to calculate phase shift