Added cgi-mode and fixed tag-mode bug