Fixed a bug for n==1