CGI: better usage and fixes