Lot of javascript related fixes