Fix two JavaScript errors in the front end preview bar script