fixing javascript error when run locally