Fix rem-calc function