bug fixes by Nevin and code to prevent IE compatibility mode