fixing demlayer,calls to calc function