Added import of cgi to support python < 2.6
Fix Python 2.5 stdout issue