Auto fix equality with None to IS NULL, fix dead code and some old bugs.