lightirc: clean code and fix NPEs