fixed bugs with l func