fix l1 calculation