added support for old browsers (not tested)