fixing undefined variable $l