Various bug fixes to do with cross-browser compliance