fixed to run in a browser without jquery