Fix IE history problems in a more elegant way