fix bug on deltad calculation