line memory function bug fix