don't set content type before we've something to say, reformat html generation, fix extra </select>