better error checking, fix scalar context to $cgi->keywords