add cross-browser styles to <legend>, minor bug fixes