Fixing some javascript issues