changing line function to fix "undefined is not a fucntion"