Replacing faulty UI line() calls instead of crashing