divide by 0 and l not defined fix