ruby -> javascript fixes