Fixed Javascript.

Fixed broken JS functionality, oops...