fixed some js bugz